﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace MINERP.ExportPhoto
{
    public partial class FrmSetting : Form
    {
        public FrmSetting()
        {
            InitializeComponent();
        }

        private void buttonFolder_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBD = new FolderBrowserDialog();
            string path=Properties.Settings.Default.SaveFolder;
            if (Directory.Exists(path))
            {
                folderBD.SelectedPath = path;
            }
            if (folderBD.ShowDialog() == DialogResult.OK)
            {
                textBoxSaveFolder.Text = folderBD.SelectedPath;
            }
        }

        private void FrmSetting_Load(object sender, EventArgs e)
        {
            string path = Properties.Settings.Default.SaveFolder;
            textBoxSaveFolder.Text = path;
            //0上1下2左3右
            comboBoxBarCodeLocation.SelectedIndex = Properties.Settings.Default.BarLocationType;
            textEditFontSize.Text = Properties.Settings.Default.FontSize.ToString();
            textEditBarcodeHeigth.Text = Properties.Settings.Default.BarCodeHeigth.ToString();
            textEditBarcodeSize.Text = Properties.Settings.Default.BarcodeSize.ToString();
            textEditAutoSizeInch.Text = Properties.Settings.Default.AutoSizeInch.ToString();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.SaveFolder = textBoxSaveFolder.Text;
            Properties.Settings.Default.BarLocationType = comboBoxBarCodeLocation.SelectedIndex;
            Properties.Settings.Default.BarcodeSize = Convert.ToInt32(textEditBarcodeSize.Text);
            Properties.Settings.Default.FontSize = Convert.ToInt32(textEditFontSize.Text);
            Properties.Settings.Default.BarCodeHeigth=Convert.ToInt32(textEditBarcodeHeigth.Text);
            Properties.Settings.Default.AutoSizeInch = Convert.ToInt32(textEditAutoSizeInch.Text);
            Properties.Settings.Default.Save();
        }

        private void groupBox2_Enter(object sender, EventArgs e)
        {

        }
    }
}
